package cn.xhy.material.dal.mysql.brand;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.xhy.material.controller.admin.brand.vo.BrandPageReqVO;
import cn.xhy.material.dal.dataobject.brand.BrandDO;
import org.apache.ibatis.annotations.Mapper;


/**
 * 品牌 Mapper
 *
 * @author xhy
 */
@Mapper
public interface BrandMapper extends BaseMapperX<BrandDO> {

    default PageResult<BrandDO> selectPage(BrandPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BrandDO>()
                .likeIfPresent(BrandDO::getBrandName, reqVO.getBrandName())
                .eqIfPresent(BrandDO::getMaterialId, reqVO.getMaterialId())
                .eqIfPresent(BrandDO::getType, reqVO.getType())
                .betweenIfPresent(BrandDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BrandDO::getId));
    }

}
